﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.UI.Common;
using Sinacor.UI.Bovespa.ImportacaoExportacao.Communication.Bovespa.ManutencaoOrdens.Calendario;

namespace Sinacor.UI.Bovespa.ImportacaoExportacao.Communication.Translator.DataContractToModel
{
    public class Calendario
    {
        #region Construtor

        public Calendario() { }

        #endregion

        #region Metodos

        /// <summary>
        /// ToCalendario
        /// </summary>
        /// <param name="from"></param>
        /// <returns></returns>
        public Model.Calendario ToCalendario(CalendarioResponse from)
        {
            Model.Calendario retorno = new Model.Calendario();

            if (from == null)
                return null;

            retorno.DataPregao = from.DataPregao;

            return retorno;
        }

        /// <summary>
        /// ToCalendario - LIST
        /// </summary>
        /// <param name="from"></param>
        /// <returns></returns>
        public ModelCollection<Model.Calendario> ToCalendario(List<CalendarioResponse> from)
        {
            ModelCollection<Model.Calendario> lista = new ModelCollection<Model.Calendario>();
            Model.Calendario item = null;

            if (from == null)
                return null;

            foreach (CalendarioResponse inLista in from)
            {
                item = this.ToCalendario(inLista);
                lista.Add(item);
            }

            return lista;
        }

        #endregion
    }
}
